-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD][14.0] New module hr_holidays_validator_list #91
Conversation
b18b0e2
to
d5920e7
Compare
d5920e7
to
305e73d
Compare
0bb47bc
to
e8ae591
Compare
a1b2c1b
to
1de1cdd
Compare
1de1cdd
to
7a177b5
Compare
or Approver (determined in settings/users).""", | ||
) | ||
|
||
def _set_leave_manager_id_from_leave_manager_ids(self, values): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have used a stored readable only computed method on leave_manager_id with a depends on leave_manager_ids to propagate any change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right I am going to check that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StephaneMangin The field leave_manager_ids
is already a computed stored field. Question is can we insert nicely the set of the values from the M2M nicely or not. We might want to keep leave_manager_ids value to it's current natural computation.
What we could probably do to improve the code is:
Override https://github.com/odoo/odoo/blob/17.0/addons/hr_holidays/models/hr_employee.py#L152-L159
this way:
@api.depends('parent_id', 'leave_manager_ids')
def _compute_leave_manager(self):
for employee in self:
if self.leave_manager_ids:
self.leave_manager_id = leave_manager_ids[0]
else:
super()._compute_leave_manager()
values["leave_manager_id"] = values["leave_manager_ids"][0][-1][-1] | ||
return values | ||
|
||
def _add_leave_manager_ids_in_group(self, values): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An onchange would have suffice to affect groups on managers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, we are on hr_employee, an onchange should only affect the values of the current form. Groups won't be available from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typos and a proposal of improvement of the code.
values["leave_manager_id"] = values["leave_manager_ids"][0][-1][-1] | ||
return values | ||
|
||
def _add_leave_manager_ids_in_group(self, values): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, we are on hr_employee, an onchange should only affect the values of the current form. Groups won't be available from here.
or Approver (determined in settings/users).""", | ||
) | ||
|
||
def _set_leave_manager_id_from_leave_manager_ids(self, values): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StephaneMangin The field leave_manager_ids
is already a computed stored field. Question is can we insert nicely the set of the values from the M2M nicely or not. We might want to keep leave_manager_ids value to it's current natural computation.
What we could probably do to improve the code is:
Override https://github.com/odoo/odoo/blob/17.0/addons/hr_holidays/models/hr_employee.py#L152-L159
this way:
@api.depends('parent_id', 'leave_manager_ids')
def _compute_leave_manager(self):
for employee in self:
if self.leave_manager_ids:
self.leave_manager_id = leave_manager_ids[0]
else:
super()._compute_leave_manager()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
… leave_manager_ids, for somecase that trigger unwanted fields update
@victorvermot you should check the CI: the tests are failing. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
A module making replacing the current leave_manager_id field by a many2many field called leave_manager_ids. Thus allowing a user to have several leave managers.
TODO: